#include "../logs/log.hpp"


void test_log(const std::string& name)
{
    INFO("%s", "测试开始");

    Mylog::Logger::ptr logger = Mylog::LoggerManager::GetInstance().getLogger("anync_logger");
    logger->debug("%s", "日志测试");
    logger->info("%s", "日志测试");
    logger->warn("%s", "日志测试");
    logger->error("%s", "日志测试");
    logger->fatal("%s", "日志测试");

    INFO("%s", "测试结束");
}

int main()
{
    std::unique_ptr<Mylog::LoggerBuilder> bulider(new Mylog::GlobalLoggerBuilder());
    bulider->bulidLoggerName("anync_logger");
    bulider->bulidLoggerLevel(Mylog::LogLevel::value::WARN);
    bulider->bulidLoggerType(Mylog::LoggerType::LOGGER_ASYNC);
    bulider->bulidFormatter("[%c][%f:%l]%m%n");
    bulider->buildSink<Mylog::FileSink>("./logfile/async.log");
    bulider->buildSink<Mylog::StdoutSink>();
    bulider->buildSink<Mylog::RollBySizeSink>("./logfile/roll-async-by-size.log", 1024 * 1024);
    bulider->build();
    test_log("anync_logger");
    return 0;
}